package com.jiangSheng.mall.app.controller;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jiangSheng.mall.app.services.UserServices;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/users")
@Api("这是查询用户的方法")
public class UsersController {
	
	@Autowired
	private UserServices userServices;
	
	@RequestMapping("/listPage")
	@ApiOperation("这是查询用户分页")
	public HashMap<String, Object> listPage(Integer page, Integer limit, String name) {

		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("page", (page - 1) * limit);
		map.put("rows", limit);
		map.put("name", name);
		HashMap<String, Object> result = new HashMap<String, Object>();
		result.put("data", userServices.listPage(map));
		result.put("count", userServices.count(null));
		result.put("code", 0);
		result.put("msg", "");
		return result;

	}
}
